package me.qingy.shiro.service;

import me.qingy.core.entity.User;
import me.qingy.core.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author qingy
 * @since 2021-05-07
 */
@Component
public class RegisterService {

    @Autowired
    private UserService userService;

    @Autowired
    private PasswordService passwordService;

    public void register(User user){
        user.setSalt("salt");
        user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), "salt"));
        userService.save(user);
    }
}
